<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        搜索名称：<input type="text" v-model="keyword" @click="search"/>
        <table border="1">
            <tr style="background-color: blue;">
                <th>Name</th>
                <th>Gender</th>
                <th>Age</th>
            </tr>
            <tr v-for="(item,index) in search()" :key="index">
                <td>{{item.name}}</td>
                <td>{{item.gender}}</td>
                <td>{{item.age}}</td>
            </tr>
        </table>
    </div>
</body>
</html>
<script src="js/vue.min.js"></script>
<script>
    var app=new Vue({
        el:"#app",
        data:{
            arr:[
                {name:"rick",gender:"male",age:21},
                {name:"dawei",gender:"male",age:26},
                {name:"demen",gender:"male",age:26},
                {name:"Jack",gender:"male",age:20},
                {name:"John",gender:"female",age:18},
                {name:"Lcuy",gender:"female",age:16},
            ],
            keyword:""
        },
        methods:{
            search:function(){
                return this.arr.filter(item=>{
                    return item.name.indexOf(this.keyword)!=-1;
                })
            }
        }
    });
</script>